<div class="login-box">
    <div class="login-logo">
        <a href="#"><b><?= OC['system_name'] ?></b>管理后台</a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">欢迎登录系统</p>
        <form class="layui-form" action="/home/login">
            <div class="layui-form-item">
                <label class="layui-form-label">账号</label>
                <div class="layui-input-block">
                    <input type="text" name="UserLogin[username]" lay-verify="required" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-block">
                    <input type="password" name="UserLogin[password]" lay-verify="required" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-block">
                    <input type="checkbox" name="UserLogin[remember]" value="1" title="保持登录" lay-skin="primary"
                           checked>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit lay-filter="submit-btn" style="width:100%;">
                        立即登录
                    </button>
                </div>
            </div>
            <input type="hidden" name="<?= Yii::$app->request->csrfParam ?>"
                   value="<?= Yii::$app->request->csrfToken ?>">
        </form>
        <a href="/home/forget-password">忘记密码</a>
    </div>
    <!-- /.login-box-body -->
</div>
<script>
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form();
        form.on('submit(submit-btn)', function (data) {
            var loading = layer.load(0, {shade: <?=Yii::$app->params['layui_shade']?>, time: <?=Yii::$app->params['layui_time']?>});
            $.post(data.form.action, data.field, function (rs) {
                layer.msg(rs.msg);
                if (rs.code === 0) {
                    setTimeout(function () {
                        window.location.href = rs.redirect;
                    }, <?=Yii::$app->params['layui_set_timeout']?>);
                }
                layer.close(loading);
            }, 'json');
            return false;
        });
    });
</script>